<?
include_once($_SERVER['DOCUMENT_ROOT']."/lucy/config.php");
include_once(INC.'sess.php');
include_once(CLA."speech.class.php");

if($_POST['word'] != "" AND $_POST['feeling'] != ""){
	$word = str_replace(" ", "+", $_POST['word']);
	$feeling = $_POST['feeling'];

	
	$speech = new Speech($feeling, $word, "sajūta");
	if($speech->save()){
		$_SESSION['print']['echo'] = "Pievienots jauna sajūta <u><b>$word</b></u>";
		$mod_name = "print";
		$send = "<meta http-equiv='refresh' content=\"0;url=http://localhost/lucy/sys/mod/".$mod_name.".php?inSess=".session_id()."\">";
		echo $send;
	}
}elseif($_POST['cancel'] == 1){
		$_SESSION['print']['echo'] = "Neko nesaglabāju :(";
		
		
		$mod_name = "print";
		$send = "<meta http-equiv='refresh' content=\"0;url=http://localhost/lucy/sys/mod/".$mod_name.".php?inSess=".session_id()."\">";
		echo $send;
}

echo "Nesapratu :( <br/>";
echo "Pie kāda tipa šis izteiciens pieder?";
?>

<form action="" method="POST">
	<table border="0">
		<tr>
			<td>
				sajūta:
			</td>
			<td>
				<input type="text" name="word" value="<?=$_SESSION['feeling'];?>">
			</td>
		</tr>		
		<tr>
			<td>
				feeling:
			</td>
			<td>
				<select name="feeling">
					<? for ($i=1;$i<=5;$i++){ ?>
						<option value="<?=$i;?>"><?=$i;?></option>
					<? } ?>
				</select>
			</td>
		</tr>
		<tr>
			<td>
				
			</td>
			<td>
				<input type="submit" name="submit" value="Saglabāt">
			</td>
		</tr>
	</table>
</form>

<form action="" method="POST">
	<input type="hidden" name="cancel" value="1">
	<input type="submit" name="submit" value="Atcelt">
</form>